package com.song.rabbitmq.springbootorderrabbitmqproducerttl.callback;

import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;

/**
 * 消息确认机制
 */
//每个RabbitTemplate实例，你只能设置一个ConfirmCallback回调函数。
public class MessageConfirmCallback implements RabbitTemplate.ConfirmCallback {
    @Override
    public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        if (ack) {
            System.out.println("消息确认成功！！！");
        } else {
            System.out.println("消息确认失败!!!!");
        }
    }
}
